package com.logistic.common;

import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
* 处理时间的类
*/

public class MyDateUtil{
	// 获取固定格式的时间
	public static String getStringDate() {
		Date currentTime = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String dateString = formatter.format(currentTime);
		return dateString;
	}
	
	public static String getFormattedDate(Timestamp ts) {
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
		return formatter.format(ts);
	}
	
	//返回当前的时间,时间格式为  MM-dd-yyyy
	public static String getCurrentFormattedDate() {
		Date currentTime = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat("MM-dd-yyyy");
		String dateString = formatter.format(currentTime);
		return dateString;
	}
}; 
